package vn.com.aptech.msh.controller;

import java.io.Serializable;
import javax.annotation.PostConstruct;

import javax.enterprise.context.RequestScoped;
import javax.faces.event.ValueChangeEvent;
import javax.inject.Named;
import vn.com.aptech.msh.utils.ResourceBundleHelper;

/**
 *
 * @author trietto
 */
@Named("successPage")
@RequestScoped
public class SuccessPageController implements Serializable {

    private String msgId;
    private String title = "This is a success page";
    private String content = "What do you want from us ?!?";
    private boolean feature;

    @PostConstruct
    public void init() {
    }

    public void onReceiveMsgId(ValueChangeEvent vce) {
        String mId = vce.getNewValue().toString();
        String sTitle = "success." + mId + ".title";
        String sContent = "success." + mId + ".content";
        String sFeature = "success." + mId + ".feature";

        title = ResourceBundleHelper.get(sTitle);
        content = ResourceBundleHelper.get(sContent);
        feature = ResourceBundleHelper.get(sFeature).equalsIgnoreCase("true");
        // for example, receive estate id to view a building
        // do something to query out the detail data here
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public boolean isFeature() {
        return feature;
    }

    public void setFeature(boolean feature) {
        this.feature = feature;
    }

    public String getMsgId() {
        return msgId;
    }

    public void setMsgId(String msgId) {
        this.msgId = msgId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }
}
